package fun.asgc.boot.netty.quartz.test2;

import fun.asgc.boot.netty.annotation.Bean;
import fun.asgc.boot.netty.annotation.EnableJob;
import fun.asgc.boot.netty.annotation.NeutrinoApplication;
import fun.asgc.boot.netty.context.NeutrinoLauncher;
import fun.asgc.boot.netty.quartz.DefaultJobSource;
import fun.asgc.boot.netty.quartz.JobExecutor;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 *
 * @author: aoshiguchen
 * @date: 2022/9/4
 */
@EnableJob
@NeutrinoApplication
public class Launcher {

	public static void main(String[] args) {
		NeutrinoLauncher.runSync(Launcher.class, args);
	}

	@Bean
	public JobExecutor jobExecutor() {
		JobExecutor executor = new JobExecutor();
		executor.setJobSource(new DefaultJobSource());
		executor.setThreadPoolExecutor(new ThreadPoolExecutor(5, 20, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<>()));
		executor.setJobCallback(new JobCallback());
		return executor;
	}

}
